Scale online indicator dynamically for large avatars#6219
Conversation
…lick Channel info screen was triggered by tapping the header title. Redesign feedback requires it on the top-right element (channel avatar). - Change onChannelAvatarClick type from (() -> Unit)? to ((Channel) -> Unit)? - Update sample to use onChannelAvatarClick instead of onHeaderTitleClick
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
The 96dp avatar in channel info screens used ExtraLarge indicator dimensions (designed for 64dp), making the dot proportionally small. - Convert OnlineIndicatorDimensions from enum to data class - Scale indicator size proportionally for avatars > 64dp - 96dp avatar now gets 24dp indicator (1.5x scale) instead of 16dp
953199d to
a41414f
Compare
SDK Size Comparison 📏
|
WalkthroughThe PR updates avatar click callback signatures across compose messaging components to pass the Channel object to handlers instead of parameterless callbacks. Additionally, OnlineIndicatorDimensions is restructured from an enum to a data class with companion object instances, and proportional scaling logic is added for online indicators in extra-large avatars. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/MessagesScreen.kt (1)
122-145:⚠️ Potential issue | 🟠 MajorAllow callers to remove the title click target.
MessageListHeaderonly drops click semantics whenonHeaderTitleClick == null, butMessagesScreenandDefaultTopBarContentstill require a non-null lambda and default it to{}. After moving channel-info navigation to the avatar, this leaves the title as a dead clickable element. Make this callback nullable through this chain, and mirror that inChatComponentFactory.MessageListHeader, so avatar-only screens can render a truly non-interactive title.Based on learnings, "In GetStream/stream-chat-android, PRs against major version branches (e.g., v7) are allowed to introduce breaking public API changes."
Also applies to: 301-324
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/MessagesScreen.kt` around lines 122 - 145, MessagesScreen currently forces a non-null onHeaderTitleClick by defaulting it to an empty lambda which prevents MessageListHeader from being non-clickable; change the onHeaderTitleClick parameter in MessagesScreen to be nullable (onHeaderTitleClick: ((channel: Channel) -> Unit)? = null), propagate that nullable type into DefaultTopBarContent's parameter and invocation (pass null through), and update DefaultTopBarContent and any usages to accept a nullable lambda; then update ChatComponentFactory.MessageListHeader's API to accept a nullable onHeaderTitleClick and ensure MessageListHeader checks for null before adding click semantics so screens wanting an inert title can pass null. Ensure all call sites and defaults are adjusted accordingly.stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatComponentFactory.kt (1)
682-703:⚠️ Potential issue | 🟡 MinorAdd changelog entry for
MessageListHeaderandMessageListHeaderTrailingContentcallback signature changes.The
ChatComponentFactoryextension points forMessageListHeaderandMessageListHeaderTrailingContentnow require callbacks with(Channel) -> Unitsignatures, breaking custom implementations. This change must be documented inCHANGELOG.mdunder thestream-chat-android-composesection with a breaking change marker (🚨) explaining the signature updates and migration path for SDK consumers.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatComponentFactory.kt` around lines 682 - 703, Add a breaking change entry to CHANGELOG.md under the stream-chat-android-compose section documenting that the ChatComponentFactory extension points MessageListHeader and MessageListHeaderTrailingContent now require callbacks with the signature (Channel) -> Unit; include the 🚨 marker, a short description of the change (old vs new signature), and a migration note telling consumers to update their custom implementations to accept a Channel parameter (e.g., change handlers passed into MessageListHeader and MessageListHeaderTrailingContent to (channel: Channel) -> Unit) and any sample before/after usage to make the migration clear.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@stream-chat-android-compose/api/stream-chat-android-compose.api`:
- Line 2079: Add an explicit "🚨 Breaking change:" entry to the v7 migration
notes / CHANGELOG stating that MessageListHeader's onChannelAvatarClick callback
signature changed from (() -> Unit)? to ((Channel) -> Unit)?; mention the
impacted public API (MessageListHeader and any callers like MessagesScreen that
accept the callback) and give a short migration example (replace parameterless
lambdas with a lambda that accepts a Channel and uses it) so consumers know to
update usages accordingly.
---
Outside diff comments:
In
`@stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/MessagesScreen.kt`:
- Around line 122-145: MessagesScreen currently forces a non-null
onHeaderTitleClick by defaulting it to an empty lambda which prevents
MessageListHeader from being non-clickable; change the onHeaderTitleClick
parameter in MessagesScreen to be nullable (onHeaderTitleClick: ((channel:
Channel) -> Unit)? = null), propagate that nullable type into
DefaultTopBarContent's parameter and invocation (pass null through), and update
DefaultTopBarContent and any usages to accept a nullable lambda; then update
ChatComponentFactory.MessageListHeader's API to accept a nullable
onHeaderTitleClick and ensure MessageListHeader checks for null before adding
click semantics so screens wanting an inert title can pass null. Ensure all call
sites and defaults are adjusted accordingly.
In
`@stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatComponentFactory.kt`:
- Around line 682-703: Add a breaking change entry to CHANGELOG.md under the
stream-chat-android-compose section documenting that the ChatComponentFactory
extension points MessageListHeader and MessageListHeaderTrailingContent now
require callbacks with the signature (Channel) -> Unit; include the 🚨 marker, a
short description of the change (old vs new signature), and a migration note
telling consumers to update their custom implementations to accept a Channel
parameter (e.g., change handlers passed into MessageListHeader and
MessageListHeaderTrailingContent to (channel: Channel) -> Unit) and any sample
before/after usage to make the migration clear.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 6af81665-c313-4856-9134-ce9336cea2d0
📒 Files selected for processing (8)
stream-chat-android-compose-sample/src/main/java/io/getstream/chat/android/compose/sample/ui/MessagesActivity.ktstream-chat-android-compose/api/stream-chat-android-compose.apistream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/avatar/OnlineIndicator.ktstream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/avatar/UserAvatar.ktstream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/MessagesScreen.ktstream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/header/MessageListHeader.ktstream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/theme/ChatComponentFactory.ktstream-chat-android-docs/src/main/kotlin/io/getstream/chat/docs/kotlin/compose/messages/MessageListHeader.kt
HideChannel is no longer in group channel options, so the state doesn't change after hide/unhide actions. Remove the second awaitItem() calls that now time out.
|
|
🚀 Available in v7.0.0-beta |



Goal
Fix the online indicator appearing too small on the 96dp avatar in the channel info screen. The indicator dimensions were designed for avatars up to 64dp.
Implementation
OnlineIndicatorDimensionsfromenumtodata classto support dynamic valuesAvatarSize.ExtraExtraLarge(64dp), following the same dynamic scaling pattern used byresolveStackedAvatarDimensions()🎨 UI Changes
Online indicator on the direct channel info screen avatar is now proportionally sized.
Testing
Summary by CodeRabbit
New Features
Documentation